package com.woniu.woniuk16.controller;


import com.woniu.woniuk16.dto.AccountSelRulesDto;
import com.woniu.woniuk16.entity.WoniuAccountRule;
import com.woniu.woniuk16.model.Result;
import com.woniu.woniuk16.param.AccountToRuleParam;
import com.woniu.woniuk16.service.WoniuAccountRuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author tiangle
 * @since 2021-12-17
 */
@RestController
@RequestMapping("/woniuAccountRule")
public class WoniuAccountRuleController {
    @Autowired
    private WoniuAccountRuleService woniuAccountRuleService;

    @GetMapping("/selRules/{id}")
    public Result selRules(@PathVariable Integer id){

        AccountSelRulesDto accountSelRulesDto = woniuAccountRuleService.selById(id);
        return Result.getInstance(accountSelRulesDto);
    }

    @PostMapping("/changeRule")
    public Result changeRules(@RequestBody AccountToRuleParam accountToRuleParam){
        woniuAccountRuleService.changeRule(accountToRuleParam);

        return Result.getInstance(null).setMessage("设置成功");
    }


}

